﻿using BPM.Web.Shared.Auth;
using BPM.Web.Shared.Data;
using WebApiClientCore;
using WebApiClientCore.Attributes;
namespace BPM.Web.Shared.Service;

[TokenFilter]
public interface IAppClient : IHttpApi
{
    /// <summary>
    /// 分页查询系统应用
    /// </summary>
    /// <param name="body"></param>
    /// <param name="token"></param>
    /// <returns></returns>
    [HttpGet("sysApp/page")]
    ITask<XnRestfulResult<PageResult<SysApp>>> PageAsync([JsonContent] AppPageInput body, CancellationToken token = default);

    /// <summary>
    /// 增加系统应用
    /// </summary>
    /// <param name="body"></param>
    /// <param name="token"></param>
    /// <returns></returns>
    [HttpPost("sysApp/add")]
    ITask<XnRestfulResult<string>> AddAsync([JsonContent] AddAppInput body, CancellationToken token = default);

    /// <summary>
    /// 删除系统应用
    /// </summary>
    /// <param name="body"></param>
    /// <param name="token"></param>
    /// <returns></returns>
    [HttpPost("sysApp/delete")]
    ITask<XnRestfulResult<string>> DeleteAsync([JsonContent] BaseId body, CancellationToken token = default);

    /// <summary>
    /// 更新系统应用
    /// </summary>
    /// <returns>Success</returns>
    /// <exception cref="ApiException">A server side error occurred.</exception>
    [HttpPost("sysApp/edit")]
    ITask<XnRestfulResult<string>> EditAsync([JsonContent] UpdateAppInput body, CancellationToken token = default);

    /// <summary>
    /// 获取系统应用
    /// </summary>
    /// <param name="id"></param>
    /// <param name="token"></param>
    /// <returns></returns>
    [HttpGet("sysApp/detail")]
    ITask<XnRestfulResult<SysApp>> DetailAsync(QueryAppInput body, CancellationToken token = default);

    /// <summary>
    /// 获取系统应用列表
    /// </summary>
    /// <param name="token"></param>
    /// <returns></returns>
    [HttpGet("sysApp/list")]
    ITask<XnRestfulResult<List<SysApp>>> ListAsync(CancellationToken token = default);

    /// <summary>
    /// 设为默认应用
    /// </summary>
    /// <param name="body"></param>
    /// <param name="token"></param>
    /// <returns></returns>
    [HttpPost("sysApp/setAsDefault")]
    ITask<XnRestfulResult<string>> SetAsDefaultAsync([JsonContent] SetDefaultAppInput body, CancellationToken token = default);

    /// <summary>
    /// 修改用户状态
    /// </summary>
    /// <param name="body"></param>
    /// <param name="token"></param>
    /// <returns></returns>
    [HttpPost("sysApp/changeStatus")]
    ITask<XnRestfulResult<string>> ChangeStatusAsync([JsonContent] ChangeUserAppStatusInput body, CancellationToken token = default);
}
